﻿using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MediatR;
using Loong.Orders;
using Microsoft.AspNetCore.Authorization;

namespace Loong.Web.Api.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class OrderController : ControllerBase
    {
        private readonly IMediator _mediator;

        public OrderController(IMediator mediator)
        {
            _mediator = mediator;
        }

        [HttpGet]
        [AllowAnonymous]
        [Route("CreateOrder")]
        public async Task<string> CreateOrder()
        {
            return await _mediator.Send(new CreateOrderComand());
        }
    }
}
